package com.ww.prodiver.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.ww.service.UserService;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName:
 * @author:
 * @Description:
 * @Date
 **/
@RestController
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/user/addUser")
    public String addUser() {
        userService.add();
        return "添加成功";
    }


    @GetMapping("/user/findAllUser")
    public String allUser() {
        List<User> users = userService.findAllUser();
        System.out.println(users.toString());
        return users.toString();
    }

    @GetMapping("/user/findUser")
    public String user() {
        User user = userService.findUserByUserId("22");
        return user.toString();
    }
}
